package com.itheima.extendsdemo;

import com.itheima.Student;

/**
 * 2025/4/12 10:11
 */
public class Dog extends Animal{

    private String name;

    public Dog() {
    }

    public Dog(String name) {
        this.name = name;
    }

    public void bark(){
        System.out.println("汪汪汪");
    }

    @Override //该注解的作用，就是让编译器帮我们检查该方法是否重写了父类的方法
   public void sound(){
        System.out.println("汪汪汪");
    }
    //重写Object这个默认父类的toString方法
    @Override
    public String toString(){
        return "Dog{name="+name+"}";
    }
}
